#!/usr/bin/python
#coding:utf-8
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.cli import CLI

class loop(Topo):
    # loop
    def build(self):
        sw1 = self.addSwitch('a{}'.format(1))
        sw2 = self.addSwitch('a{}'.format(2))
        sw3 = self.addSwitch('a{}'.format(3))

        host1 = self.addHost('h{}'.format(1))
        host2 = self.addHost('h{}'.format(2))
        self.addLink(sw1, host1)
        self.addLink(sw2, host2)

        self.addLink(sw1, sw2)
        self.addLink(sw2, sw3)
        self.addLink(sw3, sw1)

topos = {'mytopo': (lambda: loop())}

